package com.scott.spring.ch08.service;

import org.springframework.beans.factory.InitializingBean;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

/**
 * @author 黄后林
 * @version 1.0
 * @date 2021-12-14 13:46:47
 */
public class RoleService{


    public RoleService() {
        System.out.println("--------执行ch08#RoleService--------");
    }




    public int add(int x ,int y){
        System.out.println("--------执行ch08#add--------");
        int sum = x+y;
        return sum;
    }

    // 1、容器关闭前执行
    @PreDestroy
    public void preDestroy() {
        System.out.println("--------执行ch12#preDestroy--------");
    }
}
